/***************************************************************************
 *   Copyright (C) 2007 by Alexandre Masselot,,,   *
 *   alex@alex-laptop   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef BOLPEAKTHEOMSMSFACTORYBASIC_H
#define BOLPEAKTHEOMSMSFACTORYBASIC_H

#include <boost/tokenizer.hpp>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <vector>

#include "peaktheomsmsfactory.h"
#include "aminoacid.h"
#include "masscalculator.h"
#include "chargemapper.h"

namespace bol {

/**
  create simple series (e.g. y, b ... without loss)

  @author Alexandre Masselot,,, <alex@alex-laptop>
 */
  class PeakTheoMsmsFactoryBasic : public PeakTheoMsMsFactory
  {
    private:
      /**
          weel, it contains the fragmentation series and should somehow not remain private here, but I let it here until idea have matured a little bit
      */
      class BasicFragSeries{
        public:
        /// +/-1 for n/c term
        const int m_dir;
        /// series name
        const string m_name;
        /// mass shift
        const double m_startMass;
        /// 1/charge
        const double m_factor;
        ///reference index
        const ChargedSeries m_chargedSeries;
        BasicFragSeries(const string name, const int dir, const unsigned int charge, const double startMass, const unsigned int index):m_name(name), m_dir(dir), m_factor(1.0/charge), m_startMass(startMass), m_chargedSeries(index, charge){}
      };

      ChargeMapper m_chargeMapper;
      vector<vector<const BasicFragSeries*> >m_fragSeries;
    public:
    /**
     * instanciate a new factory
     * @param
    */
      PeakTheoMsmsFactoryBasic();
      
      /**
       * set a list of series (e.g. "y,y++,b,b++") for a given charge (nothing means that all charged candidates will fragment under the same seies list)
       * @param serieslist
       * @param  c is the charge
       */
      void setSeries(const string& serieslist, const unsigned int c=1);

      ~PeakTheoMsmsFactoryBasic();

      void computeTheoMasses(const Peptide& pept,
                             Spectrum<PeakTheoMsms*>& spectrum,
                             const unsigned int charge,
                             const bool showDescription
                            )const;

  void setChargeMapper(const ChargeMapper& theValue) {
      m_chargeMapper = theValue;
  }
  

  ChargeMapper chargeMapper() const{
      return m_chargeMapper;
  }
  

  };

}

#endif
